/**
 * 
 */
package com.oron3.bouncer.objects.shapes;



/**
 * @author Ofek
 *
 */
public class PPoint {
	public float r,a,b;


	public PPoint(final float r, final float a, final float b) {
		this.r = r;
		this.a = a;
		this.b = b;
	}
	/**
	 * 
	 */
	public PPoint() {
	}
	/**
	 * @return
	 */
	public Point toCartesian() {
		final Point cPoint = new Point();
		toCartesian(cPoint);
		return cPoint;
	}
	public void set(final PPoint p) {
		r = p.r;
		a = p.a;
		b = p.b;
	}
	/**
	 * 
	 * @param x2
	 * @param y2
	 * @param z2
	 */
	public void set(final float r2, final float a2, final float b2) {
		r = r2;
		a = a2;
		b = b2;
	}

	public void toCartesian(final Point p) {
		p.x = (float)(r*Math.cos(a)*Math.sin(b));
		p.y = (float)(r*Math.sin(a)*Math.sin(b));
		p.z = (float)(r*Math.cos(b));

	}


}
